## node ######################################################
cmake_minimum_required(VERSION 2.6)
## 工程名 ####################################################
project(node)
## 工程相关设置 ##############################################
if (WIN32)
add_definitions(-D__WINDOWS__)
add_definitions(-D_WIN32_WINNT=0x0501)
add_definitions(-D__LCC__)
add_definitions(-W3)
else()
add_definitions(-Wall)
    if (CMAKE_COMPILER_IS_GNUCXX)
        add_definitions(-std=gnu++0x)
    else ()
        add_definitions(-std=stdc++11)
    endif()
endif()

## 包含路径 ##################################################
include_directories(
    ${PROJECT_SOURCE_DIR}/../
)

## 源文件（平台无关） ########################################
set(node_SRC
    assert.h
    exception.h
    exception.cc
    macros.h
    
    app/application.h
    app/application.cc
    app/option.h
    app/option.cc
    app/option_set.h
    app/option_set.cc
    app/subsystem.h
    
    base/console.h
    
    binary/byte_converter.h
    binary/bytebuffer_exception.h
    binary/bytebuffer_exception.cc
    binary/bytebuffer.h
    binary/bytebuffer.cc
    binary/local_bytebuffer.h
    
    crypto/bignumber.h
    crypto/bignumber.cc
    crypto/sha1.h
    crypto/sha1.cc
    crypto/hmac.h
    crypto/hmac.cc
    
    db/rdb/field.h
    db/rdb/field.cc
    db/rdb/resultset.h
    db/rdb/resultset.cc
    db/rdb/connection.h
    db/rdb/connection.cc
    db/rdb/database.h
    db/rdb/database.cc
    db/rdb/prepared_statement.h
    db/rdb/prepared_statement.cc
    db/rdb/operations.h
    db/rdb/operations.cc
    db/rdb/callback.h
    db/rdb/details/mysql_resultset.h
    db/rdb/details/mysql_resultset.cc
    db/rdb/details/mysql_connection.h
    db/rdb/details/mysql_connection.cc
    db/rdb/details/mysql_database.h
    db/rdb/details/mysql_database.cc
    
    
    log/log_system.h
    log/log_system.cc
    log/log.h
    log/log.cc
    log/log_file.h
    log/log_file.cc
    
    net/socket.h
    net/socket.cc
    net/server_socket.h
    net/server_socket.cc
    net/socket_factory.h
    net/tcp_server.h
    net/tcp_server.cc
    net/tcp_worker.h
    net/tcp_worker.cc
    
    platform/define.h
    
    system/thread.h
    system/mutex.h
    system/event.h
    system/lock_guard.h
    
    util/byte_converter.h
    util/error.h
    util/string.h
    util/string.cc
    util/time.h
    util/file.h
    util/random.h
    util/random.cc
    util/profiler.h
    util/inifile.h
    util/inifile.cc
    util/locked_queue.h
)

## 源文件（平台相关） ########################################
if (WIN32)
set(plat_SRC
    base/details/console_win.cc
    
    system/details/thread_win.h
    system/details/thread_win.cc
    system/details/mutex_win.h
    system/details/event_win.h
    
    util/details/error_win.cc
    util/details/string_win.cc
    util/details/time_win.cc
    util/details/file_win.h
    util/details/file_win.cc
    util/details/profiler_win.h
    util/details/profiler_win.cc
)
else()
set(plat_SRC
)
endif()

## 生成静态库 ##################################################
add_library(node STATIC ${node_SRC} ${plat_SRC})